package com.febs.security.code;

import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.Data;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2021/6/18
 */
@Data
public class ValidateCode implements Serializable {

    private static final long serialVersionUID = -8020446016590813217L;

    private String code;

    private LocalDateTime expireTime;

    public ValidateCode(String code, int expireIn) {
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }

    public boolean isExpire() {
        return LocalDateTime.now().isAfter(expireTime);
    }

}
